import {Directive,DirectiveBinding} from 'vue'
import storage from '@/utils/storage'

export const HasPermission:Directive = {
    mounted(el:HTMLElement,binding:DirectiveBinding){
        //获取按钮权限
        let actionList = storage.getItem("actionList")
        let value = binding.value
        //判断列表中是否有对应权限标识
        let hasPermission = actionList.includes(value)
        if(!hasPermission){
            el.style.display = "none"
            el.parentNode?.removeChild(el)
        }
    }
}